<?php
/**
 * Created by PhpStorm.
 * User: 11509
 * Date: 2021/3/24
 * Time: 15:42
 */

namespace app\admin\model;

use think\facade\Db;
use think\Model;


class Gorder extends Model
{
    protected $table = 'ecm_order';

    public static function getOrderSel($where)
    {
        $sel = Gorder::field('o.order_id,o.buyer_name,o.goods_amount,o.add_time,o.remark,o.status,o.order_sn')
            ->field('s.order_status')
            ->alias('o')
            ->join('ecm_order_status s','o.status=s.status_id')
            ->where($where)
            ->paginate(['list_rows'=>10,'query'=>request()->param()]);

        return $sel;
    }

    // 查询订单状态数据
    public static function getOrderStatus()
    {
        $status = Gorder::suffix('_status')->select();

        return $status->toArray();
    }
}